<#include "user_manager_header.ftl">

			<ul class="nav nav-tabs">
			  <li class="active"><a>区划管理</a></li>
			  <li><a href="region_create">新增区划</a></li>
			</ul>
			
			<div><p></p></div>

			<div class="panel panel-default">

			  <div class="panel-body">
				<select class="selectpicker" name="provincecode" id="provincecode">
					<option value="">省</option>
					<#if prov_list?exists>
					<#list prov_list as region>  
					<option value="${region.regionCode}" <#if region.regionCode = provincecode?if_exists> selected </#if>>${region.regionName}</option>
					</#list>
					</#if>
				</select> 
			  </div>	
			  
			  <div class="panel-body">
				<select class="selectpicker" name="citycode" id="citycode">
					<option value="">市</option>
					<#if city_list?exists>
					<#list city_list as region>  
					<option value="${region.regionCode}" <#if region.regionCode = citycode?if_exists> selected </#if>>${region.regionName}</option>
					</#list>
					</#if>
				</select> 
			  </div>		  
			
			  <!-- Table -->
	        <table class="table table-striped">
	          <thead>
	            <tr>
	              <th>区划code</th>
	              <th>区划名称</th>
	              <th>行政级别</th>
	              <th>区划面积</th>
	              <th>区划人口</th>
	              <th>邮政编码</th>
	              <th>长途区号</th>
	              <th>*</th>
	            </tr>
	          </thead>
	          <tbody>
<#if region_list?exists>
<#list region_list as region>  
	            <tr>
	              <td>${region.regionCode}</td>
	              <td>${region.regionName}</td>
	              <td>${(region.regionLevel)?if_exists}</td>
	              <td>${(region.regionArea)?if_exists}</td>
	              <td>${(region.regionPopulation)?if_exists}</td>
	              <td>${(region.regionPostCode)?if_exists}</td>
	              <td>${(region.regionPhoneCode)?if_exists}</td>
	              <td>
	              	<a href="region_create?regioncode=${region.regionCode}">修改</a> 
	               	<a href="region_delete?regioncode=${region.regionCode}">删除</a> 
	              </td>
	            </tr>
</#list>
<#else>
	            <tr>
	              <td colspan="8">暂无记录</td>
	            </tr>
</#if>
	          </tbody>
	        </table>
	        
	        <p></p>
			</div>  <!-- /panel -->
			
<#include "user_manager_footer.ftl">

<script type="text/javascript">

$().ready(function() {

	//
	$('.selectpicker').selectpicker();
	
	$("#provincecode").change(function(){
		var pcode = $(this).find("option:selected").val();
		location.href = "region_list?provincecode="+pcode
	});	
	
	$("#citycode").change(function(){
		var citycode = $(this).find("option:selected").val();
		var pcode = $("#provincecode").find("option:selected").val();
		location.href = "region_list?citycode="+citycode+"&provincecode="+pcode
	});	
	
});
	      
</script> 
